package com.ruoyi.system.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.system.enums.RoomTypeEnum;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.springframework.data.annotation.Transient;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 客房信息对象 room
 *
 * @author 强盛酒店
 * @date 2023-03-07
 */
public class Room extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 客房信息id
     */
    private Long id;

    /**
     * 房间名
     */
    @Excel(name = "房间名")
    private String name;

    /**
     * 房间号
     */
    @Excel(name = "房间号")
    private String roomNum;

    /**
     * 类型
     */
    @Excel(name = "类型")
    private Integer type;
    @Transient
    private String typeName;

    /**
     * 图片
     */
    @Excel(name = "图片")
    private String picture;
    @Transient
    private List<String> pic;

    @Transient
    private String statusName;

    /**
     * 房间价格
     */
    @Excel(name = "房间价格")
    private String roomPrice;

    /**
     * 房间大小
     */
    @Excel(name = "房间大小")
    private String roomSize;

    /**
     * 便利设施
     */
    @Excel(name = "便利设施")
    private String amenity;

    /**
     * 浴室配套
     */
    @Excel(name = "浴室配套")
    private String bathroomAccessory;

    /**
     * 洗浴用品
     */
    @Excel(name = "洗浴用品")
    private String bathingSupply;

    /**
     * 可住人数
     */
    @Excel(name = "可住人数")
    private Integer peopleNum;

    /**
     * 床位信息
     */
    @Excel(name = "床位信息")
    private String bedInfo;

    /**
     * 是否提供wifi
     */
    @Excel(name = "是否提供wifi")
    private String wifi;

    /**
     * 是否有窗
     */
    @Excel(name = "是否有窗")
    private String casement;

    /**
     * 是否可吸烟
     */
    @Excel(name = "是否可吸烟")
    private String smoke;

    /**
     * 是否包含早餐
     */
    @Excel(name = "是否包含早餐")
    private String breakfast;

    /**
     * 食品饮品
     */
    @Excel(name = "食品饮品")
    private String food;

    /**
     * 媒体科技
     */
    @Excel(name = "媒体科技")
    private String media;

    /**
     * 其他信息
     */
    @Excel(name = "其他信息")
    private String other;

    /**
     * 创建人
     */
    @Excel(name = "创建人")
    private Long createUser;

    /**
     * 修改人
     */
    @Excel(name = "修改人")
    private Long updateUser;

    /**
     * 是否已删除
     */
    @Excel(name = "是否已删除")
    private Integer isDeleted;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")

    @Transient
    private Date queryTime;

    public Date getQueryTime() {
        return queryTime;
    }

    public void setQueryTime(Date queryTime) {
        this.queryTime = queryTime;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setRoomNum(String roomNum) {
        this.roomNum = roomNum;
    }

    public String getRoomNum() {
        return roomNum;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getType() {
        return type;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public String getPicture() {
        return picture;
    }

    public void setRoomPrice(String roomPrice) {
        this.roomPrice = roomPrice;
    }

    public String getRoomPrice() {
        return roomPrice;
    }

    public void setRoomSize(String roomSize) {
        this.roomSize = roomSize;
    }

    public String getRoomSize() {
        return roomSize;
    }

    public void setAmenity(String amenity) {
        this.amenity = amenity;
    }

    public String getAmenity() {
        return amenity;
    }

    public void setBathroomAccessory(String bathroomAccessory) {
        this.bathroomAccessory = bathroomAccessory;
    }

    public String getBathroomAccessory() {
        return bathroomAccessory;
    }

    public void setBathingSupply(String bathingSupply) {
        this.bathingSupply = bathingSupply;
    }

    public String getBathingSupply() {
        return bathingSupply;
    }

    public void setPeopleNum(Integer peopleNum) {
        this.peopleNum = peopleNum;
    }

    public Integer getPeopleNum() {
        return peopleNum;
    }

    public void setBedInfo(String bedInfo) {
        this.bedInfo = bedInfo;
    }

    public String getBedInfo() {
        return bedInfo;
    }

    public void setWifi(String wifi) {
        this.wifi = wifi;
    }

    public String getWifi() {
        return wifi;
    }

    public void setCasement(String casement) {
        this.casement = casement;
    }

    public String getCasement() {
        return casement;
    }

    public void setSmoke(String smoke) {
        this.smoke = smoke;
    }

    public String getSmoke() {
        return smoke;
    }

    public void setBreakfast(String breakfast) {
        this.breakfast = breakfast;
    }

    public String getBreakfast() {
        return breakfast;
    }

    public void setFood(String food) {
        this.food = food;
    }

    public String getFood() {
        return food;
    }

    public void setMedia(String media) {
        this.media = media;
    }

    public String getMedia() {
        return media;
    }

    public void setOther(String other) {
        this.other = other;
    }

    public String getOther() {
        return other;
    }

    public void setCreateUser(Long createUser) {
        this.createUser = createUser;
    }

    public Long getCreateUser() {
        return createUser;
    }

    public void setUpdateUser(Long updateUser) {
        this.updateUser = updateUser;
    }

    public Long getUpdateUser() {
        return updateUser;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    public String getTypeName() throws Exception {
        if (type != null){
            typeName = RoomTypeEnum.getEnum(type).getName();
        }
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public List<String> getPic() {
        List<String> list = new ArrayList<>();
        if (picture != null) {
            String[] split = picture.split(",");
            for (String item : split) {
                String res = "http://localhost:8080" + item;
                list.add(res);
            }
            pic = list;
        }
        return pic;
    }

    public void setPic(List<String> pic) {
        this.pic = pic;
    }

    public String getStatusName() throws Exception {
        return statusName;
    }

    public void setStatusName(String statusName) {
        this.statusName = statusName;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("name", getName())
                .append("roomNum", getRoomNum())
                .append("type", getType())
                .append("picture", getPicture())
                .append("roomPrice", getRoomPrice())
                .append("roomSize", getRoomSize())
                .append("amenity", getAmenity())
                .append("bathroomAccessory", getBathroomAccessory())
                .append("bathingSupply", getBathingSupply())
                .append("peopleNum", getPeopleNum())
                .append("bedInfo", getBedInfo())
                .append("wifi", getWifi())
                .append("casement", getCasement())
                .append("smoke", getSmoke())
                .append("breakfast", getBreakfast())
                .append("food", getFood())
                .append("media", getMedia())
                .append("other", getOther())
                .append("createUser", getCreateUser())
                .append("createTime", getCreateTime())
                .append("updateUser", getUpdateUser())
                .append("updateTime", getUpdateTime())
                .append("isDeleted", getIsDeleted())
                .toString();
    }
}
